\(\int \sin (c+d x) (a+b \sin (c+d x)) \tan ^2(c+d x) \, dx\) [1444]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 25, antiderivative size = 65 \[ \int \sin (c+d x) (a+b \sin (c+d x)) \tan ^2(c+d x) \, dx=-\frac {3 b x}{2}+\frac {a \cos (c+d x)}{d}+\frac {a \sec (c+d x)}{d}+\frac {3 b \tan (c+d x)}{2 d}-\frac {b \sin ^2(c+d x) \tan (c+d x)}{2 d} \]

[Out]

-3/2*b*x+a*cos(d*x+c)/d+a*sec(d*x+c)/d+3/2*b*tan(d*x+c)/d-1/2*b*sin(d*x+c)^2*tan(d*x+c)/d

Rubi [A] (verified)

Time = 0.08 (sec) , antiderivative size = 65, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.280, Rules used = {2917, 2670, 14, 2671, 294, 327, 209} \[ \int \sin (c+d x) (a+b \sin (c+d x)) \tan ^2(c+d x) \, dx=\frac {a \cos (c+d x)}{d}+\frac {a \sec (c+d x)}{d}+\frac {3 b \tan (c+d x)}{2 d}-\frac {b \sin ^2(c+d x) \tan (c+d x)}{2 d}-\frac {3 b x}{2} \]

[In]

Int[Sin[c + d*x]*(a + b*Sin[c + d*x])*Tan[c + d*x]^2,x]

[Out]

(-3*b*x)/2 + (a*Cos[c + d*x])/d + (a*Sec[c + d*x])/d + (3*b*Tan[c + d*x])/(2*d) - (b*Sin[c + d*x]^2*Tan[c + d*
x])/(2*d)

Rule 14

Int[(u_)*((c_.)*(x_))^(m_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*u, x], x] /; FreeQ[{c, m}, x] && SumQ[u]
 &&  !LinearQ[u, x] &&  !MatchQ[u, (a_) + (b_.)*(v_) /; FreeQ[{a, b}, x] && InverseFunctionQ[v]]

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 294

Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^
n)^(p + 1)/(b*n*(p + 1))), x] - Dist[c^n*((m - n + 1)/(b*n*(p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^(p + 1), x
], x] /; FreeQ[{a, b, c}, x] && IGtQ[n, 0] && LtQ[p, -1] && GtQ[m + 1, n] &&  !ILtQ[(m + n*(p + 1) + 1)/n, 0]
&& IntBinomialQ[a, b, c, n, m, p, x]

Rule 327

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^n
)^(p + 1)/(b*(m + n*p + 1))), x] - Dist[a*c^n*((m - n + 1)/(b*(m + n*p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^p
, x], x] /; FreeQ[{a, b, c, p}, x] && IGtQ[n, 0] && GtQ[m, n - 1] && NeQ[m + n*p + 1, 0] && IntBinomialQ[a, b,
 c, n, m, p, x]

Rule 2670

Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*tan[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> Dist[-f^(-1), Subst[Int[(1 - x^2
)^((m + n - 1)/2)/x^n, x], x, Cos[e + f*x]], x] /; FreeQ[{e, f}, x] && IntegersQ[m, n, (m + n - 1)/2]

Rule 2671

Int[sin[(e_.) + (f_.)*(x_)]^(m_)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> With[{ff = FreeFactors[Ta
n[e + f*x], x]}, Dist[b*(ff/f), Subst[Int[(ff*x)^(m + n)/(b^2 + ff^2*x^2)^(m/2 + 1), x], x, b*(Tan[e + f*x]/ff
)], x]] /; FreeQ[{b, e, f, n}, x] && IntegerQ[m/2]

Rule 2917

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.)*((a_) + (b_.)*sin[(e_.) + (f_.)
*(x_)]), x_Symbol] :> Dist[a, Int[(g*Cos[e + f*x])^p*(d*Sin[e + f*x])^n, x], x] + Dist[b/d, Int[(g*Cos[e + f*x
])^p*(d*Sin[e + f*x])^(n + 1), x], x] /; FreeQ[{a, b, d, e, f, g, n, p}, x]

Rubi steps \begin{align*} \text {integral}& = a \int \sin (c+d x) \tan ^2(c+d x) \, dx+b \int \sin ^2(c+d x) \tan ^2(c+d x) \, dx \\ & = -\frac {a \text {Subst}\left (\int \frac {1-x^2}{x^2} \, dx,x,\cos (c+d x)\right )}{d}+\frac {b \text {Subst}\left (\int \frac {x^4}{\left (1+x^2\right )^2} \, dx,x,\tan (c+d x)\right )}{d} \\ & = -\frac {b \sin ^2(c+d x) \tan (c+d x)}{2 d}-\frac {a \text {Subst}\left (\int \left (-1+\frac {1}{x^2}\right ) \, dx,x,\cos (c+d x)\right )}{d}+\frac {(3 b) \text {Subst}\left (\int \frac {x^2}{1+x^2} \, dx,x,\tan (c+d x)\right )}{2 d} \\ & = \frac {a \cos (c+d x)}{d}+\frac {a \sec (c+d x)}{d}+\frac {3 b \tan (c+d x)}{2 d}-\frac {b \sin ^2(c+d x) \tan (c+d x)}{2 d}-\frac {(3 b) \text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (c+d x)\right )}{2 d} \\ & = -\frac {3 b x}{2}+\frac {a \cos (c+d x)}{d}+\frac {a \sec (c+d x)}{d}+\frac {3 b \tan (c+d x)}{2 d}-\frac {b \sin ^2(c+d x) \tan (c+d x)}{2 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.23 (sec) , antiderivative size = 63, normalized size of antiderivative = 0.97 \[ \int \sin (c+d x) (a+b \sin (c+d x)) \tan ^2(c+d x) \, dx=-\frac {3 b (c+d x)}{2 d}+\frac {a \cos (c+d x)}{d}+\frac {a \sec (c+d x)}{d}+\frac {b \sin (2 (c+d x))}{4 d}+\frac {b \tan (c+d x)}{d} \]

[In]

Integrate[Sin[c + d*x]*(a + b*Sin[c + d*x])*Tan[c + d*x]^2,x]

[Out]

(-3*b*(c + d*x))/(2*d) + (a*Cos[c + d*x])/d + (a*Sec[c + d*x])/d + (b*Sin[2*(c + d*x)])/(4*d) + (b*Tan[c + d*x
])/d

Maple [A] (verified)

Time = 0.67 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.02

method result size
parallelrisch \(\frac {4 a \cos \left (2 d x +2 c \right )+b \sin \left (3 d x +3 c \right )+\left (-12 b x d +16 a \right ) \cos \left (d x +c \right )+9 b \sin \left (d x +c \right )+12 a}{8 d \cos \left (d x +c \right )}\) \(66\)
derivativedivides \(\frac {a \left (\frac {\sin ^{4}\left (d x +c \right )}{\cos \left (d x +c \right )}+\left (2+\sin ^{2}\left (d x +c \right )\right ) \cos \left (d x +c \right )\right )+b \left (\frac {\sin ^{5}\left (d x +c \right )}{\cos \left (d x +c \right )}+\left (\sin ^{3}\left (d x +c \right )+\frac {3 \sin \left (d x +c \right )}{2}\right ) \cos \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )}{d}\) \(94\)
default \(\frac {a \left (\frac {\sin ^{4}\left (d x +c \right )}{\cos \left (d x +c \right )}+\left (2+\sin ^{2}\left (d x +c \right )\right ) \cos \left (d x +c \right )\right )+b \left (\frac {\sin ^{5}\left (d x +c \right )}{\cos \left (d x +c \right )}+\left (\sin ^{3}\left (d x +c \right )+\frac {3 \sin \left (d x +c \right )}{2}\right ) \cos \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )}{d}\) \(94\)
risch \(-\frac {3 b x}{2}-\frac {i b \,{\mathrm e}^{2 i \left (d x +c \right )}}{8 d}+\frac {a \,{\mathrm e}^{i \left (d x +c \right )}}{2 d}+\frac {a \,{\mathrm e}^{-i \left (d x +c \right )}}{2 d}+\frac {i b \,{\mathrm e}^{-2 i \left (d x +c \right )}}{8 d}+\frac {2 i \left (-i a \,{\mathrm e}^{i \left (d x +c \right )}+b \right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}\) \(102\)
norman \(\frac {\frac {3 b x}{2}-\frac {4 a}{d}-\frac {3 b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {2 b \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {3 b \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {3 b x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}-\frac {3 b x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}-\frac {3 b x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}-\frac {4 a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}\) \(154\)

[In]

int(sec(d*x+c)^2*sin(d*x+c)^3*(a+b*sin(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/8*(4*a*cos(2*d*x+2*c)+b*sin(3*d*x+3*c)+(-12*b*d*x+16*a)*cos(d*x+c)+9*b*sin(d*x+c)+12*a)/d/cos(d*x+c)

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 61, normalized size of antiderivative = 0.94 \[ \int \sin (c+d x) (a+b \sin (c+d x)) \tan ^2(c+d x) \, dx=-\frac {3 \, b d x \cos \left (d x + c\right ) - 2 \, a \cos \left (d x + c\right )^{2} - {\left (b \cos \left (d x + c\right )^{2} + 2 \, b\right )} \sin \left (d x + c\right ) - 2 \, a}{2 \, d \cos \left (d x + c\right )} \]

[In]

integrate(sec(d*x+c)^2*sin(d*x+c)^3*(a+b*sin(d*x+c)),x, algorithm="fricas")

[Out]

-1/2*(3*b*d*x*cos(d*x + c) - 2*a*cos(d*x + c)^2 - (b*cos(d*x + c)^2 + 2*b)*sin(d*x + c) - 2*a)/(d*cos(d*x + c)
)

Sympy [F]

\[ \int \sin (c+d x) (a+b \sin (c+d x)) \tan ^2(c+d x) \, dx=\int \left (a + b \sin {\left (c + d x \right )}\right ) \sin ^{3}{\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}\, dx \]

[In]

integrate(sec(d*x+c)**2*sin(d*x+c)**3*(a+b*sin(d*x+c)),x)

[Out]

Integral((a + b*sin(c + d*x))*sin(c + d*x)**3*sec(c + d*x)**2, x)

Maxima [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 62, normalized size of antiderivative = 0.95 \[ \int \sin (c+d x) (a+b \sin (c+d x)) \tan ^2(c+d x) \, dx=-\frac {{\left (3 \, d x + 3 \, c - \frac {\tan \left (d x + c\right )}{\tan \left (d x + c\right )^{2} + 1} - 2 \, \tan \left (d x + c\right )\right )} b - 2 \, a {\left (\frac {1}{\cos \left (d x + c\right )} + \cos \left (d x + c\right )\right )}}{2 \, d} \]

[In]

integrate(sec(d*x+c)^2*sin(d*x+c)^3*(a+b*sin(d*x+c)),x, algorithm="maxima")

[Out]

-1/2*((3*d*x + 3*c - tan(d*x + c)/(tan(d*x + c)^2 + 1) - 2*tan(d*x + c))*b - 2*a*(1/cos(d*x + c) + cos(d*x + c
)))/d

Giac [A] (verification not implemented)

none

Time = 0.40 (sec) , antiderivative size = 104, normalized size of antiderivative = 1.60 \[ \int \sin (c+d x) (a+b \sin (c+d x)) \tan ^2(c+d x) \, dx=-\frac {3 \, {\left (d x + c\right )} b + \frac {4 \, {\left (b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + a\right )}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1} + \frac {2 \, {\left (b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, a\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{2}}}{2 \, d} \]

[In]

integrate(sec(d*x+c)^2*sin(d*x+c)^3*(a+b*sin(d*x+c)),x, algorithm="giac")

[Out]

-1/2*(3*(d*x + c)*b + 4*(b*tan(1/2*d*x + 1/2*c) + a)/(tan(1/2*d*x + 1/2*c)^2 - 1) + 2*(b*tan(1/2*d*x + 1/2*c)^
3 - 2*a*tan(1/2*d*x + 1/2*c)^2 - b*tan(1/2*d*x + 1/2*c) - 2*a)/(tan(1/2*d*x + 1/2*c)^2 + 1)^2)/d

Mupad [B] (verification not implemented)

Time = 15.89 (sec) , antiderivative size = 98, normalized size of antiderivative = 1.51 \[ \int \sin (c+d x) (a+b \sin (c+d x)) \tan ^2(c+d x) \, dx=-\frac {3\,b\,x}{2}-\frac {3\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+2\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+4\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+3\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )+4\,a}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-1\right )\,{\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )}^2} \]

[In]

int((sin(c + d*x)^3*(a + b*sin(c + d*x)))/cos(c + d*x)^2,x)

[Out]

- (3*b*x)/2 - (4*a + 3*b*tan(c/2 + (d*x)/2) + 4*a*tan(c/2 + (d*x)/2)^2 + 2*b*tan(c/2 + (d*x)/2)^3 + 3*b*tan(c/
2 + (d*x)/2)^5)/(d*(tan(c/2 + (d*x)/2)^2 - 1)*(tan(c/2 + (d*x)/2)^2 + 1)^2)